Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Make your Dream Unity Digging Game Today with this Technique
Rating: 4.8 out of 5(60 ratings)
545 students

Make your Dream Unity Digging Game Today with this Technique

Create a Quick & Easy Marching Squares Algorithm for any 2D Digging Game from Scratch!
Last updated 11/2025
English
English [Auto],

What you'll learn

  • Learn how to create Objects from Code
  • Learn how to use the Marching Squares Algorithm
  • Learn how to Manage & Manipulate Scalar Fields
  • Learn how to use Gizmos to Display Data
  • Learn how to Decouple your Code Effectively
  • Learn how to Create Structures to Enhance your Code

Course content

3 sections23 lectures3h 11m total length
  • Explanation5:14

    Learn how to implement the marching squares algorithm to generate diggable terrain in Unity, including corner states, mesh generation, interpolation for smoothing, and building a grid of configurations.

  • Displaying the First Vertices9:41

    Build a 2d Unity project to create procedural meshes from four vertices and triangles, forming a square, and visualize the vertices with gizmos while adjusting with a grid scale.

  • Our First Square !3:51

    Create a square mesh from scratch by defining vertices and triangles in Unity, then assign it to a mesh filter and render it in the scene.

  • Exercise - Making a Diamond Shape5:31

    Define center vertices (top, right, bottom, left) and mirror them in Unity, display with gizmos, to create a procedural mesh from scratch using code for a diamond shape.

  • The Square Configuration7:02

    Implement a four-corner configuration in Unity by adding boolean corner states, computing a bitmask with getConfiguration using bitwise logic, and preparing to set up vertices and triangles from the configuration.

  • The Square Triangulation16:44

    Apply marching squares to triangulate a square by configuring vertices and triangles in Unity, using lists and vectors, to generate dynamic, interpolated terrain.

  • Interpolation Theory3:28

    Learn to interpolate center vertex positions using a threshold to shape smooth terrains, applying linear interpolation and the inverse lerp method.

  • Interpolation12:39

    Explore interpolating center vertices with an iso value in a marching squares setup in Unity, using top/bottom left/right values and clamped lerps to render a scalar field.

  • Scalar Field Setup9:21

    Create a scalar field to drive terrain in Unity by building a grid of float values, and visualize it with gizmos and world position mapping.

  • Adding Interactions8:50

    Learn to implement interactive grid in Unity by displaying grid values in the scene, adding an input manager with raycast clicks, and triggering world position events to modify the terrain.

  • Editing the Scalar Field7:36

    Learn to edit the terrain's scalar field by converting world clicks to grid coordinates, applying a circular stamp to nearby cells, and guarding bounds with a valid grid position check.

  • Editing Multiple Grid Cells at Once6:00

    Apply a circular stamp with a configurable brush radius and strength to edit multiple grid cells at once, decreasing values to dig terrain and connect to marching squares.

  • Refactoring the Square Script9:45

    Refactor the square script into a struct that holds square data and merges the scalar field with marching squares. Triangulate with an isovalue and values array, exposing vertices and triangles.

  • The Square Grid20:58

    Build a square grid structure that holds squares and triangulates them into vertices and triangles, then visualize by generating a mesh with a mesh filter using isovalue and grid scale.

  • It's Working !2:58

    Fix the terrain generator by clearing vertices and triangles before updating the mesh, then adjust grid size and grid scale to achieve smooth, real-time updates.

  • Final Polish14:36

    Improve terrain visuals with a new unlit material and vibrant colors, and optimize performance by chunking terrain, refining carving with an exponential brush, and generating efficient meshes and colliders.

Requirements

  • Unity & Visual Studio installed
  • Very basic Unity Knowledge

Description

You !

Yeah, you!


You want to be a Better Developer right ?

You want to give more Creativity to your players, allow them to Shape & Carve Worlds ?

You want to be a bit Faster at creating worlds ?


Then this course is for You!


Astroneer, No Man’s Sky & Minecraft use Procedural Mesh Generation to create worlds.

Mobile games such as Sand Balls, Alto’s Adventure & Castle Raid are hit games, and also use the Marching Squares Algorithm to shape their levels & give more creativity to the player.


The potential behind these algorithms is Huge & is a big Time saver for developers like you.

This is why I decided to craft this course, so that you too, can learn how to create your own version of the Marching Squares Algorithm.


Together, we will do it Step-By-Step.


  • We will first learn how to Create a Procedural Mesh in Unity. You will understand the concepts of Vertices, Triangles and how to master them.

  • After making a simple Square, we will add a bit more points to our Mesh and make a One Square Version of the Marching Squares Algorithm. This will allow you to fully master the concept.

  • After Mastering the Square, we will create a simple Scalar Field (which is a fancy term for saying a field of values (I also explain in simple terms don’t worry, I hear you)).

  • We will be able to Display the Field of Values using Unity’s Gizmos system ( You might use that in almost any of your game to Debug stuff )

  • And finally, we will Merge our two systems [ The Scalar Field - The Marching Squares ] to be able to create a Fun 2D Digging System.


Time is precious, that’s why I decided to cover the aspects of this course in Under 3 Hours. You will be able to implement the system (and maybe make a quick 2D game if you’re hyped !) in less than a day.


If you ever need help, leave a comment and I’ll help asap ;).

Wanna start creating Procedural Worlds ? Click the Purple Button to your right !

Who this course is for:

  • Beginners eager to start learning about procedural worlds
  • Procedural Mesh Generation Enthusiasts
  • Advanced Devs who want to Improve their Skills